Connect to the Server
Change mode (permission) of the private key file
chmod 400 ~/Documents/<private_key.pem>
Connect to the server via ssh
ssh -i ~/Documents/<private_key.pem> ubuntu@<Public IPv4 address>
Set up LAMP
LAMP (Linux, Apache, MySQL, PHP/Perl/Python)
Update and Upgrade packages
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
apt
provides a high-level command line interface for the package management system.update
is used to download package information from all configured sources.upgrade
is used to install available upgrades of all packages currently installed on the system from the sources configured viasources.list
.
References about apt
- Ubuntu Manpage: apt - command-line interface
- explainshell.com - apt-get update && apt-get upgrade
- What does sudo apt-get update command do on Ubuntu/Debian? - nixCraft
- apt update vs apt upgrade: Differences Explained!
Install Tasksel
sudo apt install tasksel
Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated "task" onto your system.
Install lamp-server
sudo tasksel install lamp-server
Check if it has been successfully installed: curl http://localhost
Install phpMyAdmin
sudo apt install phpmyadmin
Set up MySQL
sudo mysql -u root mysql
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> SELECT User, Host FROM mysql.user;
mysql> UPDATE mysql.user SET HOST='%' WHERE User='__here_your_username';
mysql> FLUSH PRIVILEGES;
mysql> exit
The %
is a wildcard for "all hosts"
Secure the installation
sudo mysql_secure_installation
Edit MySQL database server configuration file
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
To allow remote access to MySQL, you have to comment out bind-address
# bind-address = 127.0.0.1
bind-address = 0.0.0.0
Restart MySQL
sudo service mysql restart
Create Files
Go to the directory
cd /var/www/html
Change Owner
sudo chown ubuntu /var/www/html